﻿﻿using System;
using System.Collections.Generic;
using System.Text;
namespace WebApp.App.Models.Entity.Common
{
    public class admin:NRapid.Struct
    {
		public System.Int64 id;
		public System.String user_name;
		public System.String password;
		public System.String salt;
		public System.Int64? typea;
		#region 从get列表初始化实体类
		public static bool TryParse(NRapid.NameValueCollection get,out admin par)
		{
			par=new admin();
			try
			{
						System.Int64.TryParse(get["id"],out par.id);
						par.user_name=get["user_name"];
						par.password=get["password"];
						par.salt=get["salt"];
						par.typea=null;
						if(get["typea"]!=null)
						{
							par.typea=System.Int64.Parse(get["typea"]);
						}
			}
			catch
			{
				return false;
			}
			return true;
		}
		#endregion
		#region 写Json字符串
		public override void WriteJson(System.IO.TextWriter tw)
		{
			tw.Write("{");
					tw.Write("\"id\":");
					tw.Write(id.ToString());
					tw.Write(",");
					tw.Write("\"user_name\":");
					tw.Write("\"");
					tw.Write(user_name==null?"null":user_name);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"password\":");
					tw.Write("\"");
					tw.Write(password==null?"null":password);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"salt\":");
					tw.Write("\"");
					tw.Write(salt==null?"null":salt);
					tw.Write("\"");
					tw.Write(",");
					tw.Write("\"typea\":");
					tw.Write(typea==null?"null" : typea.ToString());
			tw.Write("}");
		}
		#endregion
    }
}